import 'package:dragexample/src/animated_list.dart';
import 'package:dragexample/src/listview.dart';
import 'package:flutter/material.dart';

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Container(
        child: ListView(
          children: <Widget>[
            buildNavButton("listview", ListViewPage()),
            buildNavButton("animated list view", AnimatedPage()),
          ],
        ),
      ),
    );
  }

  Widget buildNavButton(String title, Widget targetPage) {
    return FlatButton(
      child: Text(title),
      onPressed: () {
        Navigator.of(context)
            .push(MaterialPageRoute(builder: (ctx) => targetPage));
      },
    );
  }
}
